home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / dosref23.zip / CHAPTER.001 next >
Text File  |  1992-03-16  |  37KB  |  680 lines

  1.  
  2.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  3.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  4. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  5.                      ISBN 1-878830-02-3 (disk-based text)
  6.                     Copyright (c) 1987, 1992 Dave Williams
  7.                         ┌─────────────────────────────┐
  8.                         │ Shareware Version, 03/16/92 │
  9.                         │  Please Register Your Copy  │
  10.                         └─────────────────────────────┘
  11.  
  12.  
  13.                             C H A P T E R    O N E
  14.  
  15.                               DOS AND THE IBM PC
  16.  
  17.  
  18.                                 C O N T E N T S
  19.  
  20. Some History .......................................................... 1**1
  21. What is DOS? .......................................................... 1**2
  22. Other Operating Systems ............................................... 1**3
  23. Specific Versions of MS/PC-DOS ........................................ 1**4
  24. The Operating System Heirarchy ........................................ 1**5
  25. DOS Structure ......................................................... 1**6
  26. DOS Initialization .................................................... 1**7
  27.  
  28.  
  29.  
  30. SOME HISTORY├────────────────────────────────────────────────────────── 1**1
  31.  
  32.  Development of MSDOS/PCDOS began in October 1980, when IBM began searching
  33. the market for an operating system for the yet-to-be-introduced IBM PC.
  34. Microsoft had no 8086 real operating system to sell, but quickly made a deal
  35. to license Seattle Computer Products' 86-DOS operating system, which had been
  36. written by Tim Paterson earlier in 1980 for use on that company's line of 8086,
  37. S100 bus micros. 86-DOS (also called QDOS, for Quick and Dirty Operating System)
  38. had been written as more or less a 16-bit version of CP/M, since Digital
  39. Research was showing no hurry in introducing CP/M-86.
  40.  
  41.  This code was quickly polished up and presented to IBM for evaluation. IBM
  42. had originally intended to use Digital Research's CP/M operating system, which
  43. was the industry standard at the time.
  44.  
  45.  Folklore reports various stories about the rift between DRI and IBM. The most
  46. popular story claims Gary Kildall or DRI snubbed the IBM executives by flying
  47. his airplane when the meeting was scheduled. Another story claims Kildall
  48. didn't want to release the source for CP/M to IBM, which would be odd, since
  49. they released it to other companies. One noted industry pundit claims
  50. Kildall's wife killed the deal by insisting on various contract changes. I
  51. suspect the deal was killed by the good ol'boy network. It's hard to imagine
  52. a couple of junior IBM executives giving up when ordered to a task as simple
  53. as licensing an operating system from a vendor. Wouldn't look good on their
  54. performance reports. It would be interesting to hear IBM's story...
  55.  
  56.  IBM found itself left with Microsoft's offering of "Microsoft Disk
  57. Operating System 1.0". An agreement was reached between the two, and IBM agreed
  58. to accept 86-DOS as the main operating system for thir new PC. Microsoft
  59. purchased all rights to 86-DOS in July 1981, and "IBM Personal Computer DOS
  60. 1.0" was ready for the introduction of the IBM PC in October 1981. IBM
  61. subjected the operating system to an extensive quality-assurance program,
  62. reportedly found well over 300 bugs, and decided to rewrite the programs. This
  63. is why PC-DOS is copyrighted by both IBM and Microsoft.
  64.  
  65.  Some early OEM versions of DOS had different names, such as Compaq-DOS, Z-DOS,
  66. Software Bus 86, etc.  By version 2 Microsoft managed to persuade everyone but
  67. IBM to refer to the product as "MS-DOS."
  68.  
  69.  It is sometimes amusing to reflect on the fact that the IBM PC was not
  70. originally intended to run MSDOS. The target operating system at the end of the
  71. development was for a (not yet in existence) 8086 version of CP/M. On the other
  72. hand, when DOS was originally written the IBM PC did not yet exist! Although
  73. PC-DOS was bundled with the computer, Digital Research's CP/M-86 would probably
  74. have been the main operating system for the PC except for two things - Digital
  75. Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and
  76. many software developers found it easier to port existing CP/M software to DOS
  77. than to the new version of CP/M.
  78.  
  79.  The upgrade from DOS 3.3 to 4.0 was done in-house by IBM.  DOS 4.0 was a
  80. completely IBM product, later licensed back to Microsoft. In early 1990 IBM
  81. announced that it was ceasing development of DOS and all further work would
  82. be done solely by Microsoft.
  83.  
  84.  
  85.  Microsoft Press' "MSDOS Encyclopedia" shows a reproduction of a late
  86. DOS 1.25 OEM brochure.  Microsoft was touting future enhancements to
  87. 1.25 including Xenix-compatible pipes, process forks, and multitasking,
  88. as well as "graphics and cursor positioning, kanji support, multi-user
  89. and hard disk support, and networking."  Microsoft certainly thought
  90. big, but, alas, the forks, multitasking, and multiuser support never
  91. came about, at least in US versions of DOS.  Oddly, the flyer claims
  92. that
  93.  
  94.  "MS-DOS has no practical limit on disk size. MS-DOS uses 4-byte XENIX
  95. OS compatible pointers for file and disk capacity up to 4 gigabytes."
  96.  
  97.  Umm... yeah.  One sort of gets the idea nobody at Microsoft had a hard
  98. disk larger than 32 megabytes...
  99.  
  100.  For the record they actually delivered:
  101.  
  102. Xenix-compatible pipes             DOS 2.0  ("|" operator)
  103. process forks, and multitasking   eDOS 4.0  (not delivered in the US)
  104. multi-user                         never delivered
  105. graphics and cursor positioning    DOS 2.0  (ANSI.SYS, more than likely)
  106. kanji support                      DOS 2.01, 2.25 (double-byte char set)
  107. hard disk support                  DOS 2.0  (subdirectories)
  108. networking                         DOS 3.1  (file locking, MS Networks)
  109.  
  110.  Early Microsoft ads pumped DOS' Xenix-like features and promised Xenix
  111. functionality in future releases.
  112.  
  113.  We'll probably never know what the real story was behind eDOS/DOS 4/
  114. DOS 5/286DOS/OS2.  Microsoft had announced their intent to build a
  115. multitasking, multiuser version of MSDOS as early as 1982.  They shipped
  116. betas of "DOS 4.0" in '86 and early '87, before 3.3 was even announced.
  117. Microsoft UK announced they had licensed 4.0 to Apricot Computer, and
  118. the French Postal Service was supposed to be running it.  I've never
  119. been able to find out if Apricot ever shipped any 4.0 to end users.
  120.  
  121.  Despite Gordon Letwin's acid comments about problems with the 80286
  122. processor, I doubt the '286 was the barrier between users and a
  123. multitasking MSDOS.  I also doubt there was any shortage of programming
  124. talent at Microsoft - Digital Research's Concurrent DOS and Software
  125. Link's PC-MOS were developed without undue trouble.
  126.  
  127.  
  128.  MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. Some
  129. of the following have been done:
  130.  
  131.  Hardware PC Emulation:
  132.  
  133.         Apple II                ->      TransPC 8088 board
  134.         Apple MacIntosh         ->      AST 80286 board
  135.         Atari 400/800           ->      Co-Power 88 board
  136.         Atari ST                ->      PC-Ditto II cartridge
  137.         Commodore Amiga 2000    ->      8088 or A2286D 80286 Bridge Board
  138.         IBM PC/RT               ->      80286 AT adapter
  139.         Kaypro 2                ->      Co-Power Plus board
  140.  
  141.  Software PC Emulation:
  142.  
  143.         Apple MacIntosh         ->      SoftPC
  144.         Atari ST                ->      PC-Ditto I
  145.         IBM RS/6000             ->      DOS emulation
  146.  
  147.  DOS Emulation:
  148.  
  149.         AIX (IBM RS/6000)       ->      DOS emulation with "PCSIMulator"
  150.         OS/2                    ->      DOS emulation in "Compatibility Box"
  151.         QNX                     ->      DOS window
  152.         SunOS                   ->      DOS window
  153.         Xenix                   ->      DOS emulation with DOSMerge
  154.  
  155.  
  156. WHAT IS DOS?├────────────────────────────────────────────────────────── 1**2
  157.  
  158.  DOS exists as a high-level interface between an application program and the
  159. computer. DOS stands for "Disk Operating System", which reflects the fact that
  160. its main original purpose was to provide an interface between the computer and
  161. its disk drives.
  162.  
  163.  DOS now lets your programs do simple memory management, I/O from the system
  164. console, and assorted system tasks (time and date, etc) as well as managing
  165. disk operations. Versions 3.1 and up also incorporate basic networking
  166. functions.
  167.  
  168.  With the introduction of installable device drivers and TSR (terminate but
  169. stay resident) programs in DOS 2.0, the basic DOS functions may be expanded to
  170. cover virtually any scale of operations required.
  171.  
  172.  
  173. OTHER OPERATING SYSTEMS├─────────────────────────────────────────────── 1**3
  174.  
  175.  There are a number of compatible replacements for Microsoft's MSDOS. Some are:
  176.  
  177. Alloy 386 Multiware                  (multitasking control prog, licensed DOS)
  178. Consortium Technologies MultiDOS     (multitasking, multiuser)
  179. Digital Research Concurrent DOS      (multitasking)
  180. Digital Research Concurrent DOS 386  (for 80386 computers)
  181. Digital Research Concurrent DOS XM   (multitasking, multiuser)
  182. Digital Research DR-DOS 3.31 and 5.0 (PC-DOS clones)
  183. Digital Research Multiuser DOS       (multitasking, multiuser)
  184. PC-MOS/386                           (multitasking, multiuser)
  185. Wendin-DOS                           (multitasking, multiuser)
  186. VM/386                               (multitasking)
  187.  
  188.  Various other operating systems are available for the IBM PC. These include:
  189.  
  190. Digital Research CP/M-86
  191. Digital Research Concurrent CP/M-86 (multitasking)
  192. Minix (multitasking UNIX workalike)
  193. Pick  (database-operating system)
  194. QNX   (multitasking, multiuser)
  195. UNIX  (various systems from IBM itself, Microsoft-SCO, Bell, and various UNIX
  196.        clones, single and multi user) (AIX, Xenix, AT&T System V, etc.)
  197.  
  198.  "Shell" programs exist which use DOS only for disk management while they more
  199. or less comprise a new operating system. These include:
  200.  
  201.      DesQview                        Windows                     OmniView
  202.      GEM                             TopView                     TaskView
  203.      GeoWorks
  204.  
  205.  Systems using the NEC V-series CPUs can execute Intel 8080/8085 8-bit
  206. instructions as well as the 16-bit 8088-up instructions.  They can run standard
  207. Digital Research 8-bit CP/M and MP/M directly, as well as other operating
  208. systems developed for that processor.
  209.  
  210.  
  211.  
  212. SPECIFIC VERSIONS OF MS/PC-DOS├──────────────────────────────────────── 1**4
  213.  
  214.  DOS 1.x is essentially 86-DOS.  DOS 2.x kept the multiple file layout (the two
  215. hidden files and COMMAND.COM) but for all practical purposes is an entirely
  216. different operating system with backwards compatibility with 1.x.  I seriously
  217. doubt there has been much code from 1.x retained in 2.x. DOS 3.x is merely an
  218. enhancement of 2.x; there seems little justification for jumping a whole
  219. version number.  The disk handling routines were considerably extended in 3.1,
  220. allowing disk access in a "virtual" fashion, independent of whether the drive
  221. was a local or network device.  DOS 4.0, originating as it did from outside
  222. Microsoft, can justify a version jump.  Unfortunately, 4.0 seemed to have very
  223. little reason to justify its existence - virtually all of its core features
  224. could be found in one version or another of DOS 3.x.  According to Microsoft's
  225. Gordon Letwin, DOS 5.0 was a complete rewrite with the kernel done in hand
  226. optimized assembly language.
  227.  
  228.  DOS version nomenclature: major.minor.minor.  The digit to the left of the
  229. decimal point indicates a major DOS version change.  1.0 was the first version.
  230. 2.0 added support for subdirectories, 3.0 added support for networking, 4.0
  231. added some minimal support for Lotus-Intel-Microsoft EMS.
  232.  
  233.  The first minor version indicates customization for a major application.  For
  234. example, 2.1 for the PCjr, 3.3 for the PS/2s.  The second minor version does not
  235. seem to have any particular meaning.
  236.  
  237.  The main versions of DOS are:
  238.  
  239.  86-DOS       February 1981  Paterson's Quick'n'Dirty DOS first runs on PC
  240.  PC-DOS 1.0   August   1981  original IBM release
  241.  PC-DOS 1.05  -------- ----  fixes to BASIC interpreter
  242.  PC-DOS 1.1   June     1982  bugfix, double sided drive support
  243.  MS-DOS 1.25  July     1982  for early compatibles. This is the first non-IBM
  244.                              OEM version
  245.  PC-DOS 2.0   March    1983  for PC/XT, Unix-type subdirectory support,
  246.                              installable device drivers, I/O redirection,
  247.                              subdirectories, hard disk support, handle calls
  248.  PC-DOS 1.85  April    1983  internal IBM - extended 1.1 - not released
  249.  MS-DOS 2.01  -------- 1983  first support for individual country formats, Kanji
  250.  PC-DOS 2.1   October  1983  for IBM PCjr, bugfixes for 2.0. No country support
  251.  MS-DOS 2.11  October  1983  basically a cross of PC-DOS 2.1 and MS-DOS 2.01
  252.  MS-DOS 2.12  -------- ----  special version for TI Professional
  253.  PC-DOS 3.0   August   1984  1.2 meg drive for PC/AT, some new system calls,
  254.                              new external programs, 16-bit FAT, specific support
  255.                              for IBM network
  256.  MS-DOS 3.05  -------- 1984  first OEM version of 3.x
  257.  PC-DOS 3.1   November 1984  bugfix for 3.0, implemented generic network support
  258.  MS-DOS 2.25  October  1985  extended foreign language support
  259.  PC-DOS 3.2   January  1986  720k 3.5 inch drive support, special support for
  260.                              laptops (IBM PC Convertible), XCOPY
  261.  MS-DOS 4.0   April    1986  multitasking (Europe only) - withdrawn from market
  262.  PC-DOS 3.3   April    1987  for PS/2 series, 1.44 meg support, multiple DOS
  263.                              partition support, code page switching, improved
  264.                              foreign language support, some new function calls,
  265.                              support for the AT's CMOS clock.
  266.  MS-DOS 3.31  November 1987  over-32 meg DOS partitions. Different versions
  267.                              from different OEMs (not Microsoft).  Compaq and
  268.                              Wyse are most common.
  269.  PC-DOS 3.4   -------- ----  internal IBM - not released (4.0 development)
  270.  MS-DOS 2.11R -------- 1988  bootable ROM DOS for Tandy machines
  271.  PC-DOS 4.0   August   1988  32mb limit officially broken, minor EMS support,
  272.                              more new function calls, enhanced network support
  273.                              for external commands
  274.  MS-DOS 4.01  January? 1989  Microsoft version with some bugfixes
  275.  MS-DOS 3.21R September1989  DOS in ROM, Flash File System for laptops
  276.  MS-DOS 3.3R  -------- 1990  DOS in ROM, introduced for TI laptops
  277.  MS-DOS 5.0   June     1991  new high memory support, uses up to 8 hard disks,
  278.                              command line editor and aliasing, 2.88 floppies
  279.  
  280.  IBM's PC-DOS was long considered to be the "standard" version of DOS.  Now
  281. that MS 5.0 is a commercial product most developers will probably write to it.
  282.  
  283.  Microsoft's policy has been to sell DOS only to OEMs.  Despite this, they
  284. sold small quantities of DOS 3.2, 3.3, and 4.0 without insurmountable
  285. difficulties.  DOS 5.0 was conceived from the beginning as an over-the-counter
  286. retail product.
  287.  
  288.  Incidentally, IBM refers to its DOS as "The IBM Personal Computer DOS." The
  289. term "PCDOS" is a trademark of IBM's rival DEC.
  290.  
  291.  Some versions of MS-DOS varied from PC-DOS in the available external commands.
  292. Some OEMs only licensed the basic operating system code (the xxxDOS and xxxBIO
  293. programs, and COMMAND.COM) from Microsoft, and either wrote the rest themselves
  294. or contracted them from outside software houses like Phoenix.  Most of the
  295. external programs for DOS 3.x and 4.x are written in "C" while the 1.x and 2.x
  296. utilities were written in assembly language.  Other OEMs required customized
  297. versions of DOS for their specific hardware configurations, such as Sanyo 55x
  298. and early Tandy computers, which were unable to exchange their DOS with the IBM
  299. version.
  300.  
  301.  PC-DOS 3.0 was extremely buggy on release.  It did not handle the DOS
  302. environment correctly and there were numerous documented problems with the
  303. batch file parser.  The network support code was also nonfunctional in that DOS
  304. version.  It is recommended that users upgrade to at least version 3.1.
  305.  
  306.  DEC MSDOS versions 2.11 for the Rainbow had the ANSI.SYS device driver built
  307. into the main code.  The Rainbow also used a unique quad density, single-sided
  308. floppy drive and its DOS had special support for it.
  309.  
  310.  IBM had a version 1.85 of PC-DOS in April 1983, after the introduction of DOS
  311. 2.0.  It was evidently for internal use only, supported multiple drive file
  312. searches (a primitive form of PATH), builtin MODE sommands for screen support,
  313. a /P parameter for TYPE for paused screens, an editable command stack like the
  314. public domain DOSEDIT.COM utility, and could be set up to remain completely
  315. resident in RAM instead of a resident/transient part like normal DOS.  It is a
  316. pity some of the neat enhancements didn't make it into DOS 2.0.  IBM also had
  317. an "internal use only" version 3.4, evidently used while developing DOS 4.0.
  318.  
  319.  Digital Research's DR-DOS is the first widely available DOS clone.  Version
  320. 3.4, released in June 1988, was the one first available to the American public.
  321. It was somewhat buggy and its use is not recommended.  DR 3.41 is extremely
  322. compatible and its use should pose no problems on any machine.  DR-DOS 5.0
  323. (released May, 1990) is functionally equivalent to MS-DOS 5.0.  For all
  324. practical purposes, MS 5.0 is a clone of DR 5.0, since DR beat MS to market by
  325. over a year.  According to Greg Ewald, DRI's DR-DOS product manager, DR-DOS was
  326. developed from Concurrent DOS 386 with the multiuser and multitasking code
  327. stripped out.
  328.  
  329.  Some versions of DOS used in compatibles do not maintain the 1.x, 2.x, ...
  330. numbering system.  Columbia Data Products computers labeled DOS 1.25 as DOS
  331. 2.0.  Early Compaqs labeled DOS 2.0 as DOS 1.x.  Other versions incorporated
  332. special features - Compaq DOS 3.31 and Wyse DOS 3.21 both support >32mb disk
  333. partitions in the same fashion as DOS 4.x.
  334.  
  335.  AT&T DOS 3.1 differs from generic MSDOS 3.10 in its use of cluster-size and
  336. file allocation table structures.  AT&T DOS appears to use rules not from
  337. version 3, but rather those from version 2.
  338.  
  339.  Epson Equity III and ComputerLand 3.10 DOS's appear to use cluster techniques
  340. that are a cross between versions 2 and 3.  On type DOS partitions, these DOS's
  341. use 3.x rules if the partition is larger than 32,680 sectors in total size.
  342. This implies 16 bit FAT entries as well.  On partitions below this size, they
  343. will use 2.x rules, including the 12 bit FAT entries.
  344.  
  345.  Zenith DOS 3.x and Wyse DOS 3.2 have a builtin internal device driver to
  346. handle up to 4 32Mb DOS partitions on a single hard disk. Wyse DOS 3.31 will
  347. handle single partitions up to 512Mb with a 32-bit FAT.
  348.  
  349.  According to PC Week Magazine, July 4, 1988, Arabic versions of MSDOS are
  350. shipping with a hardware copy-protection system from Rainbow Technologies.
  351. This is similar to the short-lived system used by AutoCAD 2.52 and a very few
  352. other MSDOS programs, where an adapter block is plugged into the parallel port
  353. and software makes use of coded bytes within the block.  This type of copy
  354. protection has been common on Commodore products for several years, where it is
  355. called a "dongle."
  356.  The AutoCAD dongle was defeated by a small program written within weeks of
  357. version 2.52's debut.  Version 2.62 was released 3 months later, without the
  358. dongle.  The DOS dongle will, however, prevent the system from booting at all
  359. unless it is found.
  360.  This makes the Arabic version of MSDOS the first copy-protected operating
  361. system, a dubious distinction at best.  The modifications to the operating
  362. system to support the dongle are not known at this time.  Frankly, it would
  363. seem that burning the operating system into ROMs would be cheaper and simpler.
  364.  
  365.  Versions of DOS sold in Great Britain are either newer than those sold in the
  366. US or use a different numbering system.  DOS 3.4, 4.0, 4.1, 4.2, and 4.3 had
  367. been released there between the US releases of 3.3 and 4.0.
  368.  MSDOS 4.0 (eDOS) was introduced in mid-1987 in Europe (at SICOB in Paris and
  369. sometime earlier by Apricot Computer in the UK).  It offered multitasking
  370. provided applications were specially written for it.
  371.  David Fraser (Microsoft UK Managing Director) is on record saying that "DOS
  372. 4.0 is unlikely to set the world alight and is of interest only to specific
  373. OEMs who want its features for networking and communications."   Standard DOS
  374. applications will run under DOS 4.x as a foreground task according to uncertain
  375. information.  It differs from earlier versions only in allowing background tasks
  376. to run.  For further information, see Chapter 4.
  377.  
  378.  Microsoft changed their OEM licensing agreements between DOS versions 2.x and
  379. 3.x.  OEM versions of DOS 3.x must maintain certain data areas and undocumented
  380. functions in order to provide compatibility with the networking features of the
  381. operating system.  For this reason, TSR programs will be much more reliable
  382. when operating under DOS 3.x.
  383.  
  384.  Several versions of DOS have been modified to be run out of ROM.  The Sharp
  385. PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some Tandy 1000 models
  386. have MSDOS 2.11 in ROM.  In mid September 1989 Microsoft introduced 3.21R ROMs
  387. for laptops, and in early '90 Texas Instruments laptops were the first to get
  388. the 3.3R ROMs.  Digital Research has also announced its DR-DOS 3.41 and 5.0 is
  389. available in a ROM version and Award Software is marketing DOS cards to OEMs
  390. as a plug-in to ISA-bus machines.
  391.  
  392.  IBM's release of DOS 4.0 (and the immediate subsequent release of a bugfix)
  393. was a dubious step "forward."  DOS 4.0 was the first version of DOS to come with
  394. a warranty; the catch is that IBM warranted it only for a very slim list of
  395. IBM-packaged software.  4.0 had some minor EMS support, support for large hard
  396. disks, and not much else.  With its voracious RAM requirements and lack of
  397. compatibility with previous versions of DOS (many major software packages
  398. crashed under DOS 4.0), plus the increase in price to a cool $150, there was
  399. no great rush to go to that version of DOS.
  400.  
  401.  Microsoft undertook development of MSDOS 5.0 in early 1990, soliciting
  402. input from Usenet, BIX, and Compuserve among others.  5.0 is a functional
  403. clone of Digital Research's DR-DOS 5.0.  5.0's compatibility was assured
  404. by what has been claimed as the largest beta-test program in history -
  405. in his address to the Boston Computer Society, Bill Gates announced over
  406. 7,500 testers were involved.
  407.  
  408.  
  409.  
  410.  
  411. THE OPERATING SYSTEM HIERARCHY├──────────────────────────────────────── 1**5
  412.  
  413.  
  414.  The Disk Operating System (DOS) and the ROM BIOS serve as an insulating layer
  415. between the application program and the machine, and as a source of services
  416. to the application program.
  417.  
  418.   As the term 'system' might imply, DOS is not one program but a collection
  419. of programs designed to work together to allow the user access to programs
  420. and data.  Thus, DOS consists of several layers of "control"programs and a set
  421. of "utility" programs.
  422.  
  423.  The system hierarchy may be thought of as a tree, with the lowest level being
  424. the actual hardware.  The 8088 or V20 processor sees the computer's address
  425. space as a ladder one byte wide and one million bytes long.  Parts of this
  426. ladder are in ROM, parts in RAM, and parts are not assigned.  There are also
  427. 65,536 "ports" that the processor can use to control devices.
  428.  
  429.  The hardware is normally addressed by the ROM BIOS, which will always know
  430. where everything is in its particular system.  The chips may usually also be
  431. written to directly, by telling the processor to write to a specific address or
  432. port.  This sometimes does not work as the chips may not always be at the same
  433. addresses or have the same functions from machine to machine.
  434.  
  435.  
  436.  
  437. DOS STRUCTURE├───────────────────────────────────────────────────────── 1**6
  438.  
  439. DOS consists of four components:
  440.  
  441.  * The boot record
  442.  * The ROM BIOS interface  (IBMBIO.COM, DRBIOS.SYS, or IO.SYS)
  443.  * The DOS program file    (IBMDOS.COM, DRBDOS.SYS, or MSDOS.SYS)
  444.  * The command processor   (COMMAND.COM or aftermarket replacement)
  445.  
  446.  
  447. * The Boot Record
  448.  
  449.  The boot record begins on track 0, sector 1, side 0 of every diskette prepared
  450. by the DOS FORMAT command.  The boot record is placed on diskettes to produce an
  451. error message if you try to start up the system with a nonsystem diskette in
  452. drive A.  For hard disks, the boot record resides on the first sector of the DOS
  453. partition.  All media supported by DOS use one sector for the boot record.
  454.  
  455.  
  456. * Read Only Memory (ROM) BIOS Interface and Extensions
  457.  
  458.  The file IBMBIO.COM or IO.SYS is the interface module to the ROM BIOS.
  459. This file provides a low-level interface to the ROM BIOS device routines and
  460. may contain extensions or changes to the system board ROMs.  Some compatibles do
  461. not have a ROM BIOS to extend, and load the entire BIOS from disk.  (Sanyo 55x,
  462. Viasyn machines).  Some versions of MSDOS, such as those from Compaq's MS-DOS
  463. and Digital Research's DRDOS 5.0, are named IBMBIO.COM but are not IBM files.
  464.  
  465.  These low-level interface routines include the instructions for performing
  466. operations such as displaying information on the screen, reading the keyboard,
  467. sending data out to the printer, operating the disk drives, and so on.  It is
  468. the operating system's means of controlling the hardware.  IBMBIO.COM contains
  469. any modifications or updates to the ROM BIOS that are needed to correct any
  470. bugs or add support for other types of hardware such as new disk drives.  By
  471. using IBMBIO.COM to update the ROM BIOS on the fly when the user turns on their
  472. computer, IBM does not need to replace the ROM BIOS chip itself, but makes any
  473. corrections through the cheaper and easier method of modifying the IBMBIO.COM
  474. file instead.
  475.  
  476.  IBMBIO.COM also keeps track of hardware operations on an internal stack or
  477. "scratch pad" area for the operating system to save information such as
  478. addresses it will need, etc.  An example of the use for this stack can be seen
  479. when running a program such as a word processor.  If you have told the word
  480. processor to save your letter, it will write the data to your disk.  During this
  481. time, if you start typing some more information, the keyboard generates a
  482. hardware interrupt.  Since you don't want the process of writing the information
  483. to the disk to be interrupted, DOS allocates a slot in the stack for the
  484. keyboard's hardware interrupt and when it gets a chance, (probably after the
  485. data has been written to the disk), it can process that interrupt and pick up
  486. the characters you may have been typing.  The STACKS= command in DOS 3.2+'s
  487. CONFIG.SYS file controls the number of stack frames available for this
  488. purpose.
  489.  
  490.  IBMBIO.COM also reads your CONFIG.SYS file and installs any device drivers
  491. (i.e. DEVICE=ANSI.SYS) or configuration commands it may find there.
  492.  
  493.  
  494.  
  495. * The DOS Program
  496.  
  497.  The actual DOS program is the file IBMDOS.COM or MSDOS.SYS.  It provides a high-
  498. level interface for user (application) programs.  This program consists of file
  499. management routines, data blocking/deblocking for the disk routines, and a
  500. variety of built-in functions easily accessible by user programs.
  501.  
  502.  When a user program calls these function routines, they accept high-level
  503. information by way of register and control block contents.  When a user program
  504. calls DOS to perform an operation, these functions translate the requirement
  505. into one or more calls to IBMBIO.COM, MSDOS.SYS or system hardware to complete
  506. the request.
  507.  
  508.  This section is often referred to as the "kernel" by systems programmers.
  509.  
  510.  
  511.  
  512. * The Command Interpreter
  513.  
  514.  The command interpreter, COMMAND.COM, is the part you interact with on the
  515. command line.  COMMAND.COM has three parts.  IBM calls them the "resident
  516. portion", the "initialization portion" and the "transient portion".
  517.  
  518.  IBM's original documentation spoke of installing alternate command
  519. interpreters (programs other than COMMAND.COM) with the SHELL= statement in
  520. CONFIG.SYS.  Unfortunately, IBM chose not to document much of the interaction
  521. between IBMDOS.COM and IBMBIO.COM.  By the time much of the interaction was
  522. widely understood, many commercial software programs had been written to use
  523. peculiarities of COMMAND.COM itself.
  524.  
  525.  Several programs exist that perform as actual "shells" by completely replacing
  526. COMMAND.COM and substituting their own command interpreter to use with the
  527. hidden DOS files.  Examples are Command Plus, a commercial package, and the
  528. shareware 4DOS and FlexShell packages.  Both supply greatly enhanced batch
  529. language and editing capabilities.
  530.  
  531. NOTE: DOS 3.3+ checks for the presence of a hard disk, and will default to
  532.       COMSPEC=C:\.  Previous versions default to COMSPEC=A:\.  Under some DOS
  533.       versions, if COMMAND.COM is not immediately available for reloading
  534.       (i.e., swapping to a floppy with COMMAND.COM on it) DOS may crash.
  535.  
  536.  
  537. Resident Portion:
  538.  
  539.  The resident portion resides in memory immediately following IBMDOS.COM and its
  540. data area.  This portion contains routines to process interrupts 22h (Terminate
  541. Address), 23h (Ctrl-Break Handler), and 24h (Critical Error Handler), as well as
  542. a routine to reload the transient portion if needed.  For DOS 3.x, this portion
  543. also contains a routine to load and execute external commands, such as files
  544. with exensions of COM or EXE.
  545.  
  546.  When a program terminates, a checksum is used to determine if the application
  547. program overlaid the transient portion of COMMAND.COM.  If so, the resident
  548. portion will reload the transient portion from the area designated by COMSPEC=
  549. in the DOS environment.  If COMMAND.COM cannot be found, the system will halt.
  550.  
  551.  All standard DOS error handling is done within the resident portion of
  552. COMMAND.COM.  This includes displaying error messages and interpreting the
  553. replies to the "Abort, Retry, Ignore, Fail?" message.
  554.  
  555.  Since the transient portion of COMMAND.COM is so large (containing the
  556. internal commands and all those error messages), and it is not needed when the
  557. user is running an application it can be overlaid that program if that
  558. application needs the room.  When the application is through, the resident
  559. portion of COMMAND.COM brings the transient portion back into memory to show
  560. the prompt.  This is why you will sometimes see the message "Insert disk with
  561. COMMAND.COM".  It needs to get the transient portion off the disk since it was
  562. overlaid with the application program.
  563.  
  564.  The initialization portion of COMMAND.COM follows the resident portion and is
  565. given control during the bootup procedure.  This section actually processes the
  566. AUTOEXEC.BAT file.  It also decides where to load the user's programs when they
  567. are executed.  Since this code is only needed during startup, it is overlaid by
  568. the first program which COMMAND.COM loads.
  569.  
  570.  The transient portion is loaded at the high end of memory and it is the
  571. command processor itself.  It interprets whatever the user types in at the
  572. keyboard, hence messages such as "Bad command or file name" for when the user
  573. misspells a command.  This portion contains all the internal commands (i.e.
  574. COPY, DIR, RENAME, ERASE), the batch file processor (to run .BAT files) and
  575. a routine to load and execute external commands which are either .COM or
  576. .EXE files.
  577.  
  578.  The transient portion of COMMAND.COM produces the system prompt, (C>), and
  579. reads what the user types in from the keyboard and tries to do something with
  580. it.  For any .COM or .EXE files, it builds a command line and issues an EXEC
  581. function call to load the program and transfer control to it.
  582.  
  583.  
  584.  
  585. DOS INITIALIZATION├──────────────────────────────────────────────────── 1**7
  586.  
  587.  The system is initialized by a software reset (Ctrl-Alt-Del), a hardware reset
  588. (reset button), or by turning the computer on.  The Intel 80x8x series processors
  589. always look for their first instruction at the end of their address space
  590. (0FFFF0h) when powered up or reset.  This address contains a jump to the first
  591. instruction for the ROM BIOS.
  592.  
  593.  Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check machine
  594. status and run inspection programs of various sorts.  Some machines set up a
  595. reserved RAM area with bytes indicating installed equipment (AT and PCjr).
  596.  
  597.  When the ROM BIOS finds a ROM on an adapter card, it lets that ROM take
  598. control of the system so that it may perform any set up necessary to use the
  599. hardware or software controlled by that ROM.  The ROM BIOS searches absolute
  600. addresses C8000h through E0000h in 2K increments in search of a valid ROM.
  601. A valid ROM is determined by the first few bytes in the ROM.  The ROM will have
  602. the bytes 55h, AAh, a length indicator and then the assembly language
  603. instruction to CALL FAR (to bring in a "FAR" routine).  A checksum is done on
  604. the ROM to verify its integrity, then the BIOS performs the CALL FAR to bring
  605. in the executible code.  The adapter's ROM then performs its initialization
  606. tasks and hopefully returns control of the computer back to the ROM BIOS so it
  607. can continue with the booting process.
  608.  
  609.  The ROM BIOS routines then look for a disk drive at A: or an option ROM
  610. (usually a hard disk) at absolute address C:800h.  If no floppy drive or option
  611. ROM is found, the BIOS calls int 19h (ROM BASIC if it is an IBM) or displays
  612. an error message.
  613.  
  614.  If a bootable disk is found, the ROM BIOS loads the first sector of information
  615. from the disk and then jumps into the RAM location holding that code.  This code
  616. normally is a routine to load the rest of the code off the disk, or to "boot"
  617. the system.
  618.  
  619.  The following actions occur after a system initialization:
  620.  
  621.  1.  The boot record is read into memory and given control.
  622.  
  623.  2.  The boot record then checks the root directory to assure that the first
  624.      two files are IBMBIO.COM and IBMDOS.COM or their OEM equivalents.  These
  625.      must be the first two files, and they must be in that order (IBMBIO.COM
  626.      first, with its sectors in contiguous order).
  627.      NOTE: IBMDOS.COM need not be contiguous in version 3.x+.
  628.  
  629.  3.  The boot record loads IBMBIO.COM into memory.
  630.  
  631.  4.  The initialization code in IBMBIO.COM loads IBMDOS.COM, determines
  632.      equipment status, resets the disk system, initializes the attached
  633.      devices, sets the system parameters and loads any installable device
  634.      drivers according to the CONFIG.SYS file in the root directory (if
  635.      present), sets the low-numbered interrupt vectors, relocates IBMDOS.COM
  636.      downward, and calls the first byte of DOS.
  637.      NOTE: CONFIG.SYS may be a hidden file.
  638.  
  639.  5.  DOS initializes its internal working tables, initializes the interrupt
  640.      vectors for interrupts 20h through 27h, and builds a Program Segment
  641.      Prefix for COMMAND.COM at the lowest available segment.  For DOS versions
  642.      3.10 up, DOS also initializes the vectors for interrupts 0Fh through 3Fh.
  643.      An initialization routine is included in the resident portion and assumes
  644.      control during startup.  This routine contains the AUTOEXEC.BAT file
  645.      handler and determines the segment address where user application programs
  646.      may be loaded.  The initialization routine is then no longer needed and is
  647.      overlaid by the first program COMMAND.COM loads.
  648.      NOTE: AUTOEXEC.BAT may be a hidden file.
  649.  
  650.  6.  IBMDOS.COM uses the EXEC function call to load and start the top-level
  651.      command processor.  The default command processor is COMMAND.COM in the
  652.      root directory of the boot drive.  If COMMAND.COM is in a subdirectory
  653.      or another command processor is to be used, it must be specified by a
  654.      SHELL= statement in the CONFIG.SYS file.
  655.      A transient portion is loaded at the high end of memory.  This is the
  656.      command processor itself, containing all of the internal command
  657.      processors and the batch file processor.  For DOS 2.x, this portion also
  658.      contains a routine to load and execute external commands, such as files
  659.      with extensions of COM or EXE.
  660.       This portion of COMMAND.COM also produces the DOS prompt (such as "A>"),
  661.      reads the command from the standard input device (usually the keyboard or
  662.      a batch file), and executes the command.  For external commands, it builds
  663.      a command line and issues an EXEC function call to load and transfer
  664.      control to the program.
  665.  
  666. note 1) COMMAND.COM may be a hidden file.
  667.      2) For IBM DOS 2.x, the transient portion of the command processor
  668.         contains the EXEC routine that loads and executes external commands.
  669.         For MSDOS 2.x+ and IBM DOS 3.x+, the resident portion of the command
  670.         processor contains the EXEC routine.
  671.      3) IBMDOS only checks for a file named "COMMAND.COM".  It will load
  672.         any file of that name if no SHELL= command is used.
  673.  
  674.  
  675.  That pretty much covers the bootup process.  After the command processor is
  676. loaded, it runs the AUTOEXEC.BAT file and then the user gets their prompt to
  677. begin working.
  678.  
  679.  
  680.